﻿"""文件对话框获取文件"""

from tkinter import *
from tkinter.filedialog import *

root = Tk()
root.geometry('400x100')


def test1():
    with askopenfile(title='选上传文件哦',
                         initialdir='D:\\', filetypes=[('黄片', '.txt')]) as f:
        show['text'] = f.read()


Button(root, text='请选择你的小视频', command=test1).pack()
show = Label(root, width=100, height=3, bg='green')
show.pack()
root.mainloop()
